<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<dsp:page>	
<dsp:importbean bean="/atg/dynamo/droplet/ForEach" />
<dsp:importbean bean="/atg/commerce/pricing/PriceItem" />
<dsp:importbean bean="/atg/commerce/pricing/PriceEachItem" />
<dsp:importbean bean="/atg/commerce/order/ShoppingCartModifier" />

<dsp:form name="productDetail" method="post" action="productDetail.jsp">
	<div class="basicInfo">
		<h2>
			<dsp:valueof param="product.displayName"></dsp:valueof>
			<dsp:getvalueof var="rates" param="product.reviewStars"/>
			<c:forEach var="rate" begin="0" end="${rates}">
				<c:out value="*" />
			</c:forEach>					
		</h2>
		<div class="img">
			<dsp:getvalueof var="imgUrl"
				param="product.thumbnailImage.url" />
			<img src="${fn:replace(imgUrl,'../','')}" />
		</div>		
		<dsp:droplet name="/atg/commerce/pricing/PriceItem">
			<dsp:param name="product" param="product" />
			<dsp:param name="item" param="sku" />
			<dsp:param name="elementName" value="priceItem" />
			<dsp:oparam name="output">
				<dsp:getvalueof var="salePrice"
					param="priceItem.priceInfo.salePrice" />
				<dsp:getvalueof var="discountPrice"
					param="priceItem.priceInfo.amount" />
				<p class="price">
					<span class="blod">List Price:</span> <span> <dsp:valueof
							converter="currency"
							param="priceItem.priceInfo.listPrice" />
					</span>
				</P>
				<p class="price">
					<c:choose>
						<c:when test="${salePrice > discountPrice}">
							<span class="blod">Sale Price:</span>
							<span class="was" style="margin-right: 5px;"> <dsp:valueof
									converter="currency"
									param="priceItem.priceInfo.salePrice" />
							</span>
							<span class="blod">Discount Price:</span>
							<span class="now"> <dsp:valueof
									converter="currency"
									param="priceItem.priceInfo.amount" />
							</span>
						</c:when>
						<c:otherwise>
							<span class="blod">Sale Price:</span>
							<span class="now"> <dsp:valueof
									converter="currency"
									param="priceItem.priceInfo.salePrice"></dsp:valueof>
							</span>
						</c:otherwise>
					</c:choose>
				</p>
			</dsp:oparam>
		</dsp:droplet>
		
		<p class="selectBox">
			<select id="skuSelect" name="type" class="select" onchange="javascript:typeSelect('<dsp:valueof param="product.id"/>');">
				<dsp:droplet name="ForEach">	
					<dsp:param name="array" param="product.childSKUs" />
					<dsp:param name="elementName" value="sku" />
					<dsp:oparam name="output">																
						<option value='<dsp:valueof param="sku.id"/>'><dsp:valueof param="sku.dynamicAttributes.variation"></dsp:valueof></option>																	
					</dsp:oparam>
				</dsp:droplet>
			</select>
		</p>
		
		<p class="qty">
			<span class="blod">Qty:</span>
			<dsp:input type="text"
				bean="ShoppingCartModifier.quantity" size="10"
				iclass="textInput" />
		</p>
	</div>

	<div class="imgInfo">
		<div class="info">
			<dsp:getvalueof var="skuid" param="sku.id"/>
			<div class="availability">
				Availability: <span class="green"> <dsp:include page="checkInventory.jsp?skuid=${skuid}"/>
				</span>
			</div>
<!--			
			<div class="addAccessory">
				<p class="title">Add an accessory</p>
				<p>
					<input type="checkbox" name="checkbox" id=""
						class="checkbox" /> <span class="green">&lt;Ancillary
						Product Name&gt;</span> <span class="price">$99.99</span>
				</p>
			</div>
  -->			
			<div class="btnBox">
				<dsp:input type="hidden" bean="ShoppingCartModifier.productId" paramvalue="product.id" />
				<dsp:input type="hidden" bean="ShoppingCartModifier.catalogRefIds" paramvalue="sku.id" />
				<dsp:input type="hidden" bean="ShoppingCartModifier.addItemToOrderSuccessURL" value="shoppingCart.jsp" />
				<dsp:input type="hidden" bean="ShoppingCartModifier.addItemToOrderErrorURL" value="productDetail.jsp" />				
				<dsp:input type="submit" bean="ShoppingCartModifier.addItemToOrder" value="Add To Cart" iclass="btn" />
				<a href="wishList.jsp" class="btn"><span>Addto wish list</span></a>
			</div>
		</div>
	</div>
	<div class="detailInfo">
		<p class="title">Product Detail:</p>
		<p class="text">
			<dsp:valueof param="product.longDescription" />
		</p>
		<div class="prodSKU">
			<p>
				<span class="blod">This product contains</span> (for
				bundle SKU to tell client which items are included)
			</p>
				<dsp:include page="bundleSkus.jsp"/>
		</div>
	</div>

	<hr>
	<div class="relatedProd">
		<dsp:include page="relatedProducts.jsp"/>
	</div>

</dsp:form>
</dsp:page>